<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title><{$Think.config.cfg_webname}></title>

    <link href="__CSS__/base.css" rel="stylesheet">
    <link href="__CSS__/school.css" rel="stylesheet">
    <link rel="stylesheet" href="__PUBLIC__/custom/uimaker/easyui.css">
    <link rel="stylesheet" type="text/css" href="__PUBLIC__/custom/uimaker/icon.css">

</head>
<body>
<div class="container">
    <table id="dg"></table>

</div>
<div id="tb" style="padding:0 30px;">
    <form id="searchForm">
        <div class="conditions">
            <span class="con-span">栏目名称: </span><input class="easyui-textbox" type="text" id="classname" name="classname" style="width:166px;height:35px;line-height:35px;">
            <a href="javascript:void(0)" class="easyui-linkbutton" onclick="dosearch()" iconCls="icon-search" data-options="selected:false">查询</a>
            <a href="javascript:void(0)" class="easyui-linkbutton" onclick="doreset()" iconCls="icon-reload">重置</a>
            <a href="javascript:void(0)" class="easyui-linkbutton" onclick="doadd()" iconCls="icon-add">新增</a>
            <a href="javascript:void(0)" class="easyui-linkbutton" onclick="doedit()" iconCls="icon-edit">修改</a>
            <a href="javascript:void(0)" class="easyui-linkbutton" onclick="doremove()" iconCls="icon-remove">删除</a>
        </div>
    </form>
</div>
<script type="text/javascript" src="__PUBLIC__/custom/jquery.min.js"></script>
<script type="text/javascript" src="__PUBLIC__/custom/jquery.easyui.min.js"></script>
<script type="text/javascript" src="__PUBLIC__/custom/easyui-lang-zh_CN.js"></script>

<script type="text/javascript">
    var iconCls = 'icon-list';
    var iframe = true;


    function dosearch(){
        $('#dg').datagrid('load',{
            classname: $("#classname").val(),
        });
    }

    function doreset(){
        $("#searchForm").form('reset');
        $('#dg').datagrid('load',{
//            topic: '',
        });
    }

    function doadd(){
        var title = "新增栏目管理";
        var url = '<{:U("Info/addInfoClass")}>';
        window.parent.addTab(title,url,iconCls,iframe);
    }

    function doedit(){
        var arr=$('#dg').datagrid('getSelections');
        if(arr.length!=1){
            $.messager.show({
                title:'提示信息',
                msg:'请选择一条记录修改!'
            });
        }else{
            var title = "修改栏目";
            var url = '<{:U("Info/addInfoClass")}>';
            window.parent.addTab(title,url,iconCls,iframe);
        }
    }

    function doremove(){
        $.messager.show({
            title:'提示信息',
            msg:'为避免系统异常，暂不支持删除操作！'
        });
    }

    $(function(){
        $('#dg').treegrid({
                    title:'栏目管理',
                    width:'100%',
                    height:$(window).height(),
                    autoRowHeight:true,//自动高度
                    remoteSort:false,//定义是否从服务器排序数据
                    striped:true,//行条纹化
                    checkOnSelect:true,//当用户点击某一行时，则会选中/取消选中复选框
                    collapsible:false,//是否可折叠
                    //分页
                    pagination:true,
                    pagePosition:'bottom',
//			pageNumber:1,
//			pageSize:10,
                    pageList:[10,20,30,40,50],
                    rownumbers:false,//是否显示
                    singleSelect:true,
                    nowrap:true,//则把数据显示在一行里
                    fitColumns:true,//设置为 true 时放置调整宽度。
                    idFileld:'id',
                    treeFiled:'classname',
                    frozenColumns:[[//在冻结列中加入多选框
                        {field:'chek',checkbox:true}
                    ]],
                    queryParams: {

                    },
                    url:'<{:U("Info/getInfoClass")}>',
            //data:getData(),
                toolbar:'#tb',

                columns:[[
            {field:'id',title:'ID',width:20,align:'center'},
            {field:'classname',title:'栏目名称',width:200,align:'right',sortable:true,align:'center',},
            {field:'orderid',title:'排序',width:100,align:'right',sortable:true,align:'center',
//                formatter: function(value,row,index){
//                    return value == 0 ? '否':'是';
//                }
            },
            {field:'options',title:'操作', width:200,align:'center',
                formatter: function(value,row,index){
                    var title = row.classname + '[栏目]';
                    var url = '<{:U("Info/addInfoClass")}>/id/' + row.id;
                    return '<a href="javascript:void(0);" onclick="window.parent.addTab(\'' + title + '\',\'' + url + '\',\'' + iconCls + '\',\'' + iframe + '\')">查看</a>';
                }
            },
        ]],
    })
    });

</script>
</body>
</html>
